# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-net-ftp
_gemname=net-ftp
# Keep version in sync with "Bundled gems" (https://stdgems.org) for the
# packaged Ruby version.
pkgver=0.3.3
pkgrel=0
pkgdesc="Support for the File Transfer Protocol"
url="https://github.com/ruby/net-ftp"
arch="noarch"
license="BSD-2-Clause AND Ruby"
depends="ruby"
checkdepends="ruby-rake ruby-test-unit"
makedepends="ruby-rdoc"
subpackages="$pkgname-doc"
source="https://github.com/ruby/net-ftp/archive/v$pkgver/$_gemname-$pkgver.tar.gz
	gemspec.patch
	"
builddir="$srcdir/$_gemname-$pkgver"

prepare() {
	default_prepare
	sed -i '/require .bundler/d' Rakefile
}

build() {
	gem build $_gemname.gemspec
}

check() {
	rake test
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--document ri \
		--verbose \
		$_gemname

	# Remove unnessecary files
	cd "$gemdir"
	rm -rf build_info cache extensions plugins
}

doc() {
	pkgdesc="$pkgdesc (ri docs)"

	amove "$(ruby -e 'puts Gem.default_dir')"/doc
}

sha512sums="
ace1a56de83f1369842e62a5164367281e7d10072a684ab0ad37591429623dd75de6ab672aa893651705ac62f74c12404b124a982b920142d3a5ff1296c24ec6  net-ftp-0.3.3.tar.gz
67384f6752b6446bf59197a0e95769f3e2ddbfdc019bee183154af9923adb805893206e7d03bd1d206718b154e649778b90338c69dc8f1c0a6b434eb0029e0a2  gemspec.patch
"
